<template>
  <div>
    <div class="center">
      <div class="left">
        <div class="left_logo">
          <img src="https://ichf.cn/logo-text.svg" alt="" />
        </div>
        <div>结算页</div>
      </div>
      <div class="rigin">
        <div>
          <span>1</span>
          <p class="p1">1.我的购物车</p>
        </div>
        <div>
          <span>2</span>
          <p class="p2">2.填写核对订单信息</p>
        </div>
        <div>
          <span>3</span>
          <p class="p3">3.成功提交订单</p>
        </div>
      </div>
    </div>

    <div class="t_text" v-if="data">
      <p>填写并核对订单信息</p>
      <div class="form_box">
        <p>收货人信息</p>
        <div class="box_dz">
          <button>+添加收货地址</button>
        </div>
        <p>支付方式</p>
        <div class="box_fk">
          <button>货到付款</button>
          <button>
            <span>惠</span>
            <span>在线支付</span>
            <svg xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 right-0 h-3 w-3 bg-red-600 text-white"
              fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
            </svg>
          </button>
        </div>
        <p>送货清单</p>
        <!-- 配送货物 -->
        <div class="box_ps">
          <div class="left">
            <span>配送方式</span>
            <div class="input">
              <button v-for="(item, i) in data" :key="i" :class="{ active: now == i }" @click="now = i">
                {{ item.title }}
                <svg xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 right-0 h-3 w-3 bg-red-600 text-white"
                  fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                </svg>
              </button>
              <!-- <button>同城跑腿
                                <svg xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 right-0 h-3 w-3 bg-red-600 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                                 </svg>
                            </button>
                            <button>上门自提
                                <svg xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 right-0 h-3 w-3 bg-red-600 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                                 </svg>
                            </button>
                            <button>校内跑腿
                                <svg xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 right-0 h-3 w-3 bg-red-600 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
                                 </svg>
                            </button> -->

              <!-- <input type="text" value="快递直达">
                            <input type="text" value="同城跑腿">
                            <input type="text" value="上门自提">
                            <input type="text" value="校内跑腿"> -->
            </div>
            <p>
              <span>标 准 达:</span>
              <span>{{ data[now].time }}</span>
            </p>
            <p>总重量:180g</p>
          </div>
          <div class="rigin">
            <p>
              <span>商家:</span>
              <span>兴挽花 flower</span>
            </p>
            <ul box_rigin-sp>
              <li>
                <img src="https://ichf.cn/upser/p15528805725/foods/1649257358942.jpg" alt="" />
              </li>
              <li>
                <p>紫玫瑰18枝➕ 波浪➕ 同款包装</p>
                <p>
                  所有鲜花都是活鲜花不是干花 所有花的单件重量都是正常鲜花的重量
                  所有鲜花都是需提前4天预定的 顺丰空运包邮
                </p>
                <p>食品不支持7天无理由退货</p>
              </li>
              <li>
                <p>￥119.0</p>
                <p>180g</p>
              </li>
              <li>
                <button @click="count--" :disabled="count == 1">-</button>
                <input type="text" :value="count" />
                <button @click="count++">+</button>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="text_js">
        <p>总商品金额: ￥{{ zj * count + data[now].yf }}</p>
        <p>运费: ￥{{ data[now].yf }}</p>
      </div>
      <div class="text_zj">
        <p>
          应付总额 :<span>￥{{ zj * count + data[now].yf }}.0 </span>
        </p>
      </div>
      <div class="text_tj">
        <span @click="payflower">提交订单</span>
      </div>
    </div>
    <!-- 二维码 -->
    <div class="erwm" v-show="erwm"></div>

    <!-- 页脚 -->
    <fy-footer></fy-footer>
  </div>
</template>

<script>
import FyFooter from "@/components/FyFooter.vue";
export default {
  components: { FyFooter },
  data() {
    return {
      erwm: false,
      count: 1,
      now: 2,
      zj: 119,
      data: [
        {
          title: "快递直达",
          time: "预计 2022年08月25日 18:19:22 前送达",
          yf: 0,
        },
        {
          title: "同城跑腿",
          time: "预计 2022年08月21日 18:19:22 前送达",
          yf: 0,
        },
        { title: "上门自提", time: "请到 指定地点:兴挽flower 取货", yf: 0 },
        {
          title: "校内跑腿",
          time: "预计 2022年08月20日 18:19:22 前送达",
          yf: 2,
        },
      ],
    };
  },
  methods: {
    payflower() {
      this.erwm = true;
      let paycode = document.querySelector(".erwm");
      setTimeout(() => {
        paycode.style.backgroundImage =
          "url('https://img-blog.csdnimg.cn/73c9f2d8cc3b4d13a175dcb40503a4d5.png')";
        this.zj = 0;
      }, 5500);
      setTimeout(() => {
        this.erwm = false;
        this.$router.push("/xch/home");
      }, 7000);
    },
  },
};
</script>

<style lang="scss" scoped>
div {
  .center {
    width: 853px;
    height: 36px;
    // background-color: aqua;
    margin: 0 auto;
    margin-top: 32px;
    display: flex;
    justify-content: space-between;

    .left {
      width: 224px;
      height: 36px;
      // background-color: red;
      display: flex;
      justify-content: space-between;
      font-size: 20px;
      color: #666666;

      .left_logo {
        width: 132px;

        img {
          width: 100%;
        }
      }
    }

    .rigin {
      width: 492px;
      height: 36px;
      // background-color: blue;
      display: flex;

      // align-items:center;
      div {
        width: 164px;
        height: 5px;
        background-color: #9ca3af;
        position: relative;

        p {
          margin-top: 12px;
          text-align: center;
          font-size: 14px;
        }

        .p1 {
          color: #a7f3d0;
        }

        .p2 {
          color: #10b981;
        }

        .p3 {
          color: #9ca3af;
        }

        span {
          position: absolute;
          top: -8px;
          left: 74px;
          width: 20px;
          height: 20px;
          background-color: #9ca3af;
          border-radius: 100%;
          color: #fff;
          font-size: 12px;
          box-sizing: border-box;
          text-align: center;
          line-height: 20px;
        }

        &:nth-child(1) {
          border-radius: 10px 0 0 10px;
          background-color: #a7f3d0;

          span {
            background-color: #a7f3d0;
          }
        }

        &:nth-child(2) {
          background-color: #10b981;

          span {
            background-color: #10b981;
          }
        }

        &:nth-child(3) {
          border-radius: 0 10px 10px 0;
        }
      }
    }
  }

  .t_text {
    width: 853px;
    height: 880px;
    margin: 0 auto;
    margin-top: 30px;

    p {
      width: 100%;
      color: #666666;
      font-size: 16px;
    }

    .form_box {
      width: 853px;
      height: 540px;
      border: 1px solid #e5e7eb;
      margin-top: 10px;
      box-sizing: border-box;
      padding: 12px 24px;

      p {
        font-weight: 700;
      }

      .box_dz {
        width: 803px;
        height: 32px;
        padding: 16px 0 24px;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 24px;

        button {
          border: none;
          background-color: #919191;
          border-radius: 4px;
          color: #e5e7eb;
          font-size: 14px;
          text-align: center;
          padding: 5px 10px;
          margin-left: 30px;

          &:active {
            background-color: #777777;
            color: #fff;
          }
        }
      }

      .box_fk {
        width: 100%;
        height: 60px;
        margin-top: 12px;
        // display: flex;
        box-sizing: border-box;
        padding-left: 30px;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 24px;

        button {
          width: 120px;
          border: none;
          border-radius: 4px;
          font-size: 12px;
          color: #919191;
          text-align: center;
          padding: 6px 6px;

          &:nth-child(2) {
            padding: 3px 6px;
            // background-color: #10B981;
            // display: flex;
            margin-left: 24px;
            position: relative;
            border: 2px solid red;

            span {
              font-size: 14px;
              color: #919191;
            }

            span:nth-child(1) {
              width: 20px;
              height: 20px;
              font-size: 14px;
              margin-right: 6px;
              padding: 2px;
              background-color: red;
              color: #fff;
            }

            svg {
              position: absolute;
              right: 0;
              bottom: 0;
              width: 10px;
              background-color: red;
              color: #fff;
            }
          }
        }
      }

      .box_ps {
        width: 100%;
        display: flex;
        margin-top: 12px;
        box-sizing: border-box;

        .left {
          width: 320px;
          height: 212px;
          background-color: #f9fafb;
          padding: 12px 24px 12px 24px;
          box-shadow: 1px 1px 3px #909090;

          span {
            font-size: 14px;
            color: #666666;
            font-weight: 700;
          }

          .input {
            width: 272px;
            height: 96px;
            padding-top: 16px;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;

            svg {
              width: 10px;
              height: 10px;
            }

            button {
              width: 125px;
              height: 32px;
              text-align: center;
              color: #666666;
              font-size: 14px;
              outline: none;
              background-color: #fff;
              border: 1px solid #e5e7eb;
              position: relative;

              svg {
                position: absolute;
                right: 0;
                bottom: 0;
                width: 10px;
                color: #fff;
              }

              // js遍历动态class改:成.
              &.active {
                border: 2px solid red;

                svg {
                  background-color: red;
                }
              }
            }
          }

          p:nth-child(3) {
            width: 100%;
            height: 40px;
            border-bottom: 1px solid #e5e7eb;
            margin-bottom: 16px;

            span {
              height: 50px;
              font-weight: 500;
              font-size: 14px;

              &:nth-child(2) {
                color: #333333;
                margin-left: 6px;
              }
            }
          }
        }

        .rigin {
          width: 405px;
          height: 204px;
          background-color: #eff6ff;
          padding: 16px 20px 16px 20px;
          box-shadow: 1px 1px 3px #909090;


          ul {
            margin-top: 12px;
            width: 454px;
            height: 128px;
            display: flex;
            list-style: none;

            li:nth-child(1) {
              width: 60px;
              height: 128px;

              // background-color: #10B981;
              img {
                width: 100%;
              }
            }

            li:nth-child(2) {
              width: 193px;
              height: 140px;
              margin-left: 16px;

              // background-color: yellow;
              p {
                font-size: 14px;

                &:nth-child(1) {
                  font-weight: 400;
                  margin-bottom: 6px;
                }

                &:nth-child(3) {
                  font-weight: 400;
                  color: #1e40af;
                  margin-top: 6px;
                }
              }
            }

            li:nth-child(3) {
              width: 52px;
              height: 128px;
              // background-color: aquamarine;
              padding: 0 16px;

              p {
                font-size: 14px;

                &:nth-child(1) {
                  color: red;
                  font-weight: 550;
                }

                &:nth-child(2) {
                  font-weight: 400;
                  text-align: right;
                  margin-top: 2px;
                }
              }
            }

            li:nth-child(4) {
              width: 76px;
              height: 128px;

              // background-color: brown;
              input {
                width: 24px;
                height: 16px;
                text-align: center;
                background-color: transparent;
                outline: none;
                border: none;
              }

              button {
                width: 20px;
                height: 20px;
                text-align: center;
                background-color: #fff;
                border: none;
                user-select: none;
              }
            }
          }
        }
      }
    }

    .text_js {
      // margin-top: 24px;
      padding: 24px 16px;
      box-sizing: border-box;

      p {
        width: 100%;
        text-align: right;
        font-size: 14px;
        font-weight: 550;
        margin-top: 8px;
      }
    }

    .text_zj {
      height: 40px;
      background-color: #f3f4f6;
      padding: 24px 16px;
      text-align: right;
      border-radius: 6px;
      box-shadow: 1px 1px 3px #909090;

      p {
        font-size: 14px;

        span {
          font-size: 24px;
          color: red;
          font-weight: 700;
        }
      }
    }

    .text_tj {
      height: 50px;
      padding-right: 16px;
      text-align: right;
      margin-top: 30px;

      span {
        width: 50px;
        height: 50px;
        background-color: #dc2626;
        padding: 10px 30px;
        color: #fff;
        font-size: 18px;
        border-radius: 6px;
        font-weight: 550;
      }
    }
  }
}

.erwm {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
  background: url("../../public/image/扫一扫.png") no-repeat #0006 center center;
}
</style>
